package com.designpatterns.singletonpattern;

public class TestSingletonPattern {
    public static void main(String[] args) {
        testSingtonThreadSafeOrNotTraditional();
    }

    public static void testSingtonThreadSafeOrNotTraditional() {
        Runnable task = new Runnable() {
            @Override
            public void run() {
//                SingletonAtOnce singleton = SingletonAtOnce.getSingletonAtOnce();
//                SingletonLazy singleton = SingletonLazy.getSingletonLazy();
                SingletonLazyThreadSafe1 singleton = SingletonLazyThreadSafe1.getSingletonLazyThreadSafe();
//                SingletonLazyThreadSafe2 singleton = SingletonLazyThreadSafe2.getSingletonLazyThreadSafe();
                System.out.println(singleton);
            }
        };
        for (int i = 0; i < 1000; i++) {
            new Thread(task).start();
        }
    }
}
